package com.moli.iov.admin.config;

import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 阿里云 OSS配置
 * </p>
 *
 * @author zql
 * @since 2019/9/10 10:22
 */
@Data
@Component
@Configuration
@ConfigurationProperties(prefix = "aliyun")
public class AliyunConfig {

  private String endpoint;
  private String accessKeyId;
  private String accessKeySecret;
  private String bucketName;
  private String urlPrefix;

  @Bean
  public OSSClient oSSClient() {
    return new OSSClient(endpoint, accessKeyId, accessKeySecret);
  }
}
